#include <iostream>
#include <future>
#include <memory>
#include <thread>

int Add(int x, int y)
{
    std::cout << "into Add" << std::endl;
    return x + y;
}


int main()
{
    std::promise<int> pro;

    std::future<int> res = pro.get_future();

    std::thread thr([&pro](){
        int sum = Add(11, 22);
        pro.set_value(sum);
    });


    std::cout << res.get() << std::endl;
    thr.join();
    return 0;
}